<?php
namespace App\Model;
use Illuminate\Database\Eloquent\Model;
class Usera extends Model
{
    public  $table = 'usera';
    //查询数据
     public function find(int $id){
        return $this->where('id',$id)->get()->toArray();
    }
    //修改数据
    public function edit(array &$params){
        return $this->where('id',$params['id'])->update($params);
    }


  /* wgr*/
    //查询手机号是否存在
    public function isPhone($phone)
    {
        return $this->where('phone',$phone)->get()->toArray();
    }
    //添加用户注册信息
    public function addUser($phone,$pwd,$time)
    {
        return $this->insert(['phone'=>$phone,'password'=>$pwd,'created_at'=>$time]);
    }
    //用户登录判断
    public function haveUser($phone,$pwd)
    {
        return $this->where(['phone'=>$phone,'password'=>$pwd])->first()->toArray();
    }
    //用户忘记密码-->修改密码
    public function forgetUser($pwd,$id)
    {
        return $this->where(['id'=>$id])->update(['password'=>$pwd]);
    }

}